//
//  GRXStrollHeaderView.m
//  1-MushroomStreet-自定义tabbar
//
//  Created by xmg on 15/12/25.
//  Copyright © 2015年 grx. All rights reserved.
//

#import "GRXStrollHeaderView.h"
#import "GRXPlayView.h"
#import "GRXPictureView.h"
#import "GRXHeader.h"
@interface GRXStrollHeaderView ()

/**轮播图*/
@property (nonatomic, weak) GRXPlayView *playView;

/**图片选择*/
@property (nonatomic, weak) GRXPictureView *pictureView;

/**刷新控件*/
@property (nonatomic, weak) GRXHeader *header;



@end

@implementation GRXStrollHeaderView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        //添加轮播图
        [self setUpPlayView];
        
        //添加图片选择器
        [self setUpPictureSelect];
        
        //添加刷新控件
        [self setUpRefreshHeader];
    }
    return self;
}

- (void)setUpRefreshHeader{
    GRXHeader *header = [GRXHeader getHeader];
    self.header = header;
    header.backgroundColor = [UIColor greenColor];
    [self addSubview:header];
}


//添加轮播图
- (void)setUpPlayView{

    GRXPlayView *playView = [[GRXPlayView alloc] init];
    self.playView = playView;
    [self addSubview:playView];
}


//添加图片选择器
- (void)setUpPictureSelect{
    GRXPictureView *pictureView = [[GRXPictureView alloc] init];
    self.pictureView = pictureView;
    [self addSubview:pictureView];
}


//设置轮播图等的位置
- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.playView.frame = CGRectMake(0, 0, kScreenW, 190);
    self.pictureView.frame = CGRectMake(0, 190, kScreenW, 110);
    self.header.frame = CGRectMake(0, -self.header.height, kScreenW, 50);
}

@end
